package com.star.book.controller.system;

import com.star.book.entity.User;
import com.star.book.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

import javax.servlet.http.HttpSession;
/**
 * 后台退出展示
 * */
@Controller
public class SysLogoutController {
    @Autowired
    private IUserService userService;
    @GetMapping("/sys/logout")
    public String logout(HttpSession session){
        User user = SysUserInfo.loginInfo();
        user.setUserStatus("离线");
        userService.saveOrUpdate(user);
        session.removeAttribute("user");
        return "system/login";
    }
}
